<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历</title>
</head>
<body>
<div>
  <ul>
      <!--v-for遍历数组同时每遍历一次生成一个li-->
      <li v-for="name in arr">{{name}}</li>
  </ul>
    <table border="1">
        <caption>汽车列表</caption>
        <tr>
            <th>编号</th>
            <th>品牌</th>
            <th>价格</th>
            <th>类型</th>
        </tr>
        <tr v-for="(car,i) in cars">
            <td>{{i+1}}</td>
            <td>{{car.name}}</td>
            <td>{{car.price}}</td>
            <td>{{car.type}}</td>
        </tr>
    </table>
</div>
<!--引入vue-->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.js"></script>
<script>
    let v = new Vue({
        el:"div",
        data:{
            arr:["悟空","八戒","沙僧"],
            cars:[{name:"奥迪A6",price:400000,type:"轿车"},
            {name:"奔驰",price:450000,type:"轿车"},
            {name:"蔚来",price:500000,type:"纯电SUV"},
            ]
        }
    });
</script>
</body>
</html>